<?php echo $this->render('frontend_common/header.phtml'); ?>
<?php echo $this->render('frontend_common/left_content.phtml'); ?>
<?php
	$open_oneline =  -1;
		foreach($this->listgiohoa as $STT=>$motgiohoa){
			//echo $motgiohoa['id']."<br/>";
			if( ($STT) %3 == 0){
				$open_oneline = 1;//Da mo div one line
			?>
			<div class="oneline">
			<?php }?>
			<div class="hoa">
			
				<a href="<?php echo $this->baseUrl("images/".$motgiohoa['img_url']);?>" rel="lightbox">
					<img src="<?php echo $this->baseUrl("images/".$motgiohoa['img_url']); ?>"
						title=
							'
								cssbody=[dvbdy1] 
								cssheader=[dvhdr1] 
								header=[<span class=toolTipTitle> Tên hoa : <?php echo $motgiohoa['tengiohoa']; ?></span>] 
								body=
									[
										<table >
											<tr>
												<td valign=top>Trạng thái :
													<?php 
														if($motgiohoa['slton']>0)
															echo "còn hàng";
														else 
															echo "đã hết hàng";
													?> 
												</td>
											</tr>
											<tr>
												
												<td valign=top>
													<span class=LargeTime2><b>
														<u>Giá bán là:</u> <?php echo $motgiohoa['dongiaban']; ?> Vnd</b>
													</span>
													<br>
													<hr>
												</td>
											</tr>
										</table>
									]
							'
					/>
				</a>
				
				<div class="tengiohoa">
									<a href="<?php echo $this->url(array('controller'=>'index','action'=>'viewdetail','id'=>$motgiohoa['id']));?>">
										<span><?php echo $motgiohoa['tengiohoa'] ?> </span>
									</a>
								</div><!-- END #tengiohoa -->
								
								<div class="ct-dh-btn">
									<a href="<?php echo $this->url(array('controller'=>'index','action'=>'viewdetail','id'=>$motgiohoa['id']));?>" title="chi tiết giỏ hoa">
										<span class="chitiet-btn"></span>
									</a>
									
									<a class="cart_button" href="javascript:" rel="<?php
										if ($motgiohoa['slton']>0) 
											echo $motgiohoa['id'];
										else 
											echo -1; 
									 ?>" title="Thêm hoa vào giỏ hàng" >
									 	<span class="dathoa-btn"></span>
									 </a>
								</div><!-- END #ct-dh-btn -->
			</div>
			
			<?php if( ($STT -2) %3 == 0){
				$open_oneline = 0;//Da mo div one line
			?>
			</div><!--  End of .oneline -->
		
		<?php }}
			
			//Ra ngoai foreach, neu nhu san pham chua du, vi du co 7,8 sp -> se ko vao dong if close oneline
			//Phai kiem tra de dong div do lai;
		if($open_oneline == 1) echo "</div>";
?>
<script type="text/javascript">
	$(document).ready(function(){
		$('.cart_button').click(function(){//Khi nguoi dung click vao class la: cart_button
			var id =$(this).attr('rel');//lay gia tri rel trong cho minh gan class
			//alert('id la: '+id);
			if(id!=-1)
				window.location = "<?php echo $this->baseUrl('/cart/createorder/id_sp/');?>"+id;//di chuyen sang trang khac
			else
				alert('Sản phầm này hiện tại đã hết hàng.Xin vui lòng chọn sản phẩm khác');
		});
	});
</script>
<?php // echo $this->render('frontend_common/rightcontent.phtml'); ?>
<?php echo $this->render('frontend_common/footer.phtml'); ?>